package me.ilich.piet.interpreter;

import java.security.InvalidParameterException;


public class Block {
	
	/**
	 * �� ������� ���� b ������ ��� a
	 * @param a
	 * @param b
	 * @return
	 */
	public static final int brightnessDif(Block a, Block b){
		int result = b.getBrightnes() - a.getBrightnes();
		if(result<0) result = 3 + result;
		return result;
	}
	
	public static final int colorDif(Block a, Block b){
		int result = b.getColor() - a.getColor();
		if(result<0) result = 6 + result;
		return result;
	}
		
	public static final Block instance(int brightness, int color, int size){
		Block b = new Block();
		b.setBrightness(brightness);
		b.setColor(color);
		b.setSize(size);
		return b;
	}
	
	private int mBrightness;
	private int mColor;
	private int mSize;
	
	public int getBrightnes(){
		return mBrightness;
	}
	
	public void setBrightness(int value){
		if(value!=Colourable.LIGHT && value!=Colourable.NORMAL && value!=Colourable.DARK) throw new InvalidParameterException("brightness");
		mBrightness = value;
	}	
	
	public int getColor(){
		return mColor;
	}
	
	public void setColor(int value){
		mColor = value;
	}

	public int getSize() {
		return mSize;
	}

	public void setSize(int value) {
		mSize = value;
	}

}
